package com.tulele.vtool.service.impl;

import org.springframework.stereotype.Service;
import com.tulele.vtool.mapper.BBusinessLecturerMapper;
import com.tulele.vtool.model.BBusinessLecturer;
import com.tulele.vtool.service.BBusinessLecturerService;

import javax.annotation.Resource;
import java.util.List;

/**
 * 商学院讲师信息表(BBusinessLecturer)表服务实现类
 *
 * @author makejava
 * @since 2020-10-22 15:35:30
 */
@Service("bBusinessLecturerService")
public class BBusinessLecturerServiceImpl implements BBusinessLecturerService {
    @Resource
    private BBusinessLecturerMapper bBusinessLecturerMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public BBusinessLecturer queryById(Integer id) {
        return this.bBusinessLecturerMapper.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<BBusinessLecturer> queryAllByLimit(int offset, int limit) {
        return this.bBusinessLecturerMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param bBusinessLecturer 实例对象
     * @return 实例对象
     */
    @Override
    public BBusinessLecturer insert(BBusinessLecturer bBusinessLecturer) {
        this.bBusinessLecturerMapper.insert(bBusinessLecturer);
        return bBusinessLecturer;
    }

    /**
     * 修改数据
     *
     * @param bBusinessLecturer 实例对象
     * @return 实例对象
     */
    @Override
    public BBusinessLecturer update(BBusinessLecturer bBusinessLecturer) {
        this.bBusinessLecturerMapper.update(bBusinessLecturer);
        return this.queryById(bBusinessLecturer.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.bBusinessLecturerMapper.deleteById(id) > 0;
    }
}